package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

public class GUIMenuBar extends JMenuBar implements ActionListener {

	private JMenu menuFile;
	private JMenu menuAbout;
	private JMenuItem menuitemOpen;
	private JMenuItem menuitemExit;
	private JMenuItem menuitemAbout;

	GUIMenuBar() {
		this.initialize();
	}

	private void initialize() {
		this.menuitemOpen = new JMenuItem("Öffnen");
		this.menuitemExit = new JMenuItem("Beenden");
		this.menuitemAbout = new JMenuItem("Info...");
		this.menuitemAbout.addActionListener(this);

		this.menuFile = new JMenu("Datei");
		this.menuFile.setText("Datei");
		this.menuFile.add(this.menuitemOpen);
		this.menuFile.add(new JSeparator());
		this.menuFile.add(this.menuitemExit);

		this.menuAbout = new JMenu("Hilfe");
		this.menuAbout.add(this.menuitemAbout);

		// this.add(this.menuFile);
		this.add(this.menuAbout);
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource().equals(this.menuitemAbout)) {
			new GUIMenuBarAbout();
		}
	}
}